package com.bluefish.bltuan.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bluefish.bltuan.dao.ManagerDao;
import com.bluefish.bltuan.module.user.Manager;
import com.bluefish.bltuan.service.ManagerService;
import com.bluefish.bltuan.util.PageIndex;

@Service
@Transactional
public class ManagerServiceImpl implements ManagerService {

	private ManagerDao managerDao;
	
	public void setManagerDao(ManagerDao managerDao) {
		this.managerDao = managerDao;
	}

	public void save(Manager t) {
		this.managerDao.save(t);
	}

	public void update(Manager t) {
		this.managerDao.update(t);
	}

	public void delete(Manager t) {
		this.managerDao.delete(t);
	}

	public Manager findById(Integer id) {
		return this.managerDao.findById(id);
	}

	public List<Manager> getAll(PageIndex pageIndex) {
		return this.managerDao.list(pageIndex);
	}

	public Manager doLogin(String username, String password) {
		return this.managerDao.getByNameAndPassword(username, password);
	}
	
	public Manager getByUsername(String username) {
		return this.managerDao.findByUsername(username);
	}
	
}
